package com.RPGDice;

import com.RPGDice.util.Settings;
import com.criticalritrpg.R;

import android.app.Activity;
import android.os.Bundle;
import android.text.Html;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.Window;
import android.widget.Button;
import android.widget.TextView;

public class History extends Activity implements OnClickListener {

	Button clearHistory;
	TextView historyTv;

	/** Called when the activity is first created. */
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		setContentView(R.layout.history);

		clearHistory = (Button) findViewById(R.id.clear_history_button);
		clearHistory.setOnClickListener(this);

		historyTv = (TextView) findViewById(R.id.history_tv);
		
		loadHistory();

	}
	
	private void loadHistory(){
		historyTv.setText(Html.fromHtml(Settings.getHistory()));
	}

	public void onClick(View v) {
		switch (v.getId()) {
		case R.id.clear_history_button:
			Settings.clearHistory();
			loadHistory();
			break;
		}

	}
}